package design2.command.example2;

public class Demo {
    public static void main(String[] args) {
        //接收者角色
        Receiver receiver=new Receiver();
        //Runnable类相当于抽象的命令接口，TurnOffThread为实际的命令实现
        TurnOffThread turnOffThread = new TurnOffThread(receiver);
        //Thread充当调用者角色
        Thread thread = new Thread(turnOffThread);
        thread.start();
    }
}
